﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DatabaseTransfer.Tables
{
    public class TableResults
    {
        private Dictionary<int, TableRow> rows;

        public int RowCount
        {
            get
            {
                return rows.Count;
            }
        }

        public TableResults()
        {
            rows = new Dictionary<int, TableRow>();
        }

        public void AddTableRow(TableRow row)
        {
            AddTableRow(rows.Count + 1, row);
        }

        public void AddTableRow(int rowNumber, TableRow row)
        {
            if (rows.ContainsKey(rowNumber))
            {
                rows.Remove(rowNumber);
            }

            rows.Add(rowNumber, row);
        }

        public TableRow GetTableRow(int rowNumber)
        {
            if (!rows.ContainsKey(rowNumber))
            {
                return null;
            }

            return rows[rowNumber];
        }


    }
}
